package com.youhome.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

@Data
@ApiModel
@JsonSerialize(include= JsonSerialize.Inclusion.NON_NULL)
public class HotCity {
    @JsonIgnore
    @ApiModelProperty(value = "城市ID")
    private Integer id;

    @ApiModelProperty(value = "城市中文名称")
    private String chName;

    @ApiModelProperty(value = "城市英文名称")
    private String enName;

    @ApiModelProperty(value = "城市图片")
    private String photo;

    @JsonIgnore
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @JsonIgnore
    @ApiModelProperty(value = "邮编")
    private String zipcodes;


    @JsonIgnore
    @ApiModelProperty(value = "是否启用")
    private Boolean enabled;

    public String getPhoto() {
        if (!StringUtils.isEmpty(photo)) {
            photo = "https://youhome.oss-cn-zhangjiakou.aliyuncs.com" + photo;
        }
        return photo;
    }
}